#include "uart.h"

void uart_init(uint32_t buadrate)
{
    uart_config_t uart_init_struct;
    uart_init_struct.baud_rate = buadrate;
    uart_init_struct.data_bits = UART_DATA_8_BITS;
    uart_init_struct.parity = UART_PARITY_DISABLE;
    uart_init_struct.stop_bits = UART_STOP_BITS_1;
    uart_init_struct.flow_ctrl = UART_HW_FLOWCTRL_DISABLE;
    uart_init_struct.source_clk = UART_SCLK_DEFAULT;
    uart_param_config(UART_UX, &uart_init_struct);
    uart_set_pin(UART_UX,
                 UART_TX_GPIO_PIN,
                 UART_RX_GPIO_PIN,
                 UART_PIN_NO_CHANGE,
                 UART_PIN_NO_CHANGE);
    uart_driver_install(UART_UX,UART_BUFFER_SIZE,UART_BUFFER_SIZE,0,NULL,0);
}